package per.hx.bs.web.yw.service;

import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.context.annotation.Primary;
import org.springframework.web.bind.annotation.*;
import per.hx.bs.entity.yw.YwAppraisalRecordDO;
import per.hx.bs.util.Query;
import per.hx.bs.vo.AppraisalUserVO;

import java.util.List;
import java.util.Map;

/**
 * @author HuXing
 * @date 2018/4/16  8:20
 */
@Primary
@FeignClient(value = "Huxingbs-Sys-Service")
public interface YwAppraisalUserService {
    /**
     * 需考核用户
     *
     * @param userId 用户id
     * @return 用户信息
     */
    @GetMapping(value = "yw-service/appraisalUser/userTree")
    String getUserTree(@RequestParam("userId") Long userId);

    /**
     * 获取用户是否加入考核
     *
     * @param map 查询条件
     * @return 封装数据
     */
    @PostMapping(value = "yw-service/appraisalUser/userList")
    List<AppraisalUserVO> userList(@RequestBody Map<String, Object> map);

    /**
     * 统计数量
     *
     * @param map 查询条件
     * @return 用户数量
     */
    @PostMapping(value = "yw-service/appraisalUser/userCount")
    int userCount(@RequestBody Map<String, Object> map);

    /**
     * 人员更改
     *
     * @param userId 用户id
     * @return 影响行数
     */
    @GetMapping(value = "yw-service/appraisalUser/userChange/{userId}")
    int userChange(@PathVariable("userId") Long userId);

    /**
     * 获取用户考核结果列表
     *
     * @param map 查询条件
     * @return 封装数据
     */
    @PostMapping(value = "yw-service/appraisalUser/list")
    List<YwAppraisalRecordDO> list(@RequestBody Map<String, Object> map);

    /**
     * 统计用户考核结果数量
     *
     * @param map 查询条件
     * @return 数量
     */
    @PostMapping(value = "yw-service/appraisalUser/count")
    int count(@RequestBody Map<String, Object> map);

    /**
     * 单线考核详情
     *
     * @param id record id
     * @return 考核信息
     */
    @GetMapping(value = "yw-service/appraisalUser/record/{id}")
    YwAppraisalRecordDO get(@PathVariable("id") Long id);

    /**
     * 插入考核结果
     *
     * @param recordDO 考核结果
     * @return 影响行数
     */
    @PostMapping(value = "yw-service/appraisalUser/record")
    Integer insertRecord(@RequestBody YwAppraisalRecordDO recordDO);

    /**
     * 删除考核记录
     *
     * @param id 记录id
     * @return 影响行数
     */
    @DeleteMapping(value = "yw-service/appraisalUser/record/{id}")
    Integer delete(@PathVariable("id") Long id);

    /**
     * 修改考核记录
     *
     * @param recordDO recordDO
     * @return 影响行数
     */
    @PutMapping(value = "yw-service/appraisalUser/record")
    Integer updateRecord(@RequestBody YwAppraisalRecordDO recordDO);
}
